package cn.maihe.elg.operation.centers.follow.exception;

import cn.maihe.elg.operation.centers.follow.enums.FollowRespCode;
import lombok.Getter;

/**
 * @Description
 * @Author WJH
 * @Date 2021/07/30
 */
@Getter
public class FollowException extends RuntimeException {

    private FollowRespCode respCode;

    private FollowException(FollowRespCode respCode, String message, Throwable cause) {
        super(message, cause);
        this.respCode = respCode;
    }

    public static FollowException of(FollowRespCode respCode, String message, Throwable cause) {
        String appendMsg = message.concat(cause != null ? String.valueOf(cause.getMessage()) : "");
        return new FollowException(respCode, appendMsg, cause);
    }

}
